home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / bibtex.hosek-vms-changes < prev    next >
Text File  |  1989-02-02  |  27KB  |  719 lines

  1.  3-Feb-89 14:37:44-MST,27713;000000000001
  2. Return-Path: <DHOSEK@YMIR.BITNET>
  3. Received: from CC.UTAH.EDU by SCIENCE.UTAH.EDU with TCP; Fri 3 Feb 89 14:36:53-MST
  4. Received: from YMIR.BITNET by CC.UTAH.EDU; Fri, 3 Feb 89 14:38 MST
  5. Date: Fri, 3 Feb 89 12:51 PST
  6. From: Don Hosek <DHOSEK@YMIR.BITNET>
  7. Subject: Updated BibTeX change file for VMS
  8. To: Beebe@SCIENCE.UTAH.EDU, Leichter@YALEVMS.BITNET
  9. X-VMS-To: IN%"Beebe@Science.Utah.Edu",IN%"Leichter@Yalevms"
  10. Message-id: <0091FD3B656598E0204009AA@YMIR.BITNET>
  11.  
  12. Below is teh vms-changes and cld files for my updated change file for VMS
  13. BibTeX. The program contains numerous enhancements and optimizations described
  14. in the files themselves.
  15.      
  16. It is the first in a series of change files which will eventually (I hope)
  17. cover the whole domain of standard TeX and MF software, called "HMCTeX". The
  18. ultimate goal is to have a full CLI-style interface with commands matching
  19. standard VMS for the whole bevy of programs.
  20.      
  21. -dh
  22.      
  23. %%File: BibTeX.Vms-changes
  24. This change file is for the VAX/VMS version of BibTeX
  25. 12-Feb-88 Modified for Version .99b by Jerry Leichter
  26. 15-Apr-88 Modified for Version .99c by Jerry Leichter
  27. 27-May-88 Fixed some spelling errors and typos that showed up when the code
  28.           was woven.  Added support for specifying the file name on the
  29.           command line. Nelson Beebe.
  30.  2-Dec-88 Got rid of all of the tabs so that it not only matches our copy of
  31.           the WEB, but so that it can be stored readily on a non-ascii machine
  32.           or be sent via e-mail with little fear of corruption. The beginning
  33.           of the so-called "HMC implementation." Don Hosek.
  34.  3-Dec-88 Fixed error on text_char definitions. Don Hosek.
  35.  5-Dec thru
  36.  8-Dec-88 Modified program to be called through the CLI. The qualifiers
  37.           /STAT, and /TRACE are added. Changed Vax to VAX because it bugged
  38.           Heather. Removed <CR><LF> line endings because they shouldn't have
  39.           been there. All debug..gubed stuff is removed because it's not used
  40.           very much and is better dealt with using VMS's debugger facility. -dh
  41.      
  42. Limbo.
  43. @x
  44. \def\title{\BibTeX\ }
  45. @y
  46. \pageno=\contentspagenumber \advance\pageno by 1
  47. \let\maybe=\iffalse
  48. \def\title{\BibTeX\ changes for VAX/VMS}
  49. @z
  50.      
  51. Section 1.
  52. @x
  53. The |banner| string defined here should be changed whenever \BibTeX\
  54. gets modified.
  55.      
  56. @d banner=='This is BibTeX, Version 0.99c' {printed when the program starts}
  57. @y
  58. The HMC implementation is based on work done by Nelson H.F.\ Beebe, Jerry
  59. Leichter, and an anonymous progenitor. From Beebe's version, numerous changes
  60. were made to the VAX/VMS version by Don Hosek at Harvey Mudd College for
  61. assorted enhancements, the most significant of which is the insertion of code
  62. to make \BibTeX\ a DCL verb. The date in the banner line represents the last
  63. significant change to the \BibTeX\ code; it is {\bf not} updated for program
  64. version updates unless the version update requires reworking a major portion
  65. of the change file. If major changes are made outside of the normal HMC
  66. development, an additional note should be added to the banner to distinguish
  67. the change file from the ``HMC'' version.
  68.      
  69. @d banner=='This is BibTeX, VAX/VMS Version 0.99c [HMC 12/8/88]'
  70. @z
  71.      
  72. Section 2.
  73. @x
  74. Terminal output goes to the file |term_out|, while terminal input
  75. comes from |term_in|.  On our system, these (system-dependent) files
  76. are already opened at the beginning of the program, and have the same
  77. real name.
  78.      
  79. @d term_out == tty
  80. @d term_in == tty
  81. @y
  82. Terminal output goes to the file |term_out|, while terminal input
  83. comes from |term_in|.  On our VAX/VMS, these (system-dependent) files
  84. are already opened at the beginning of the program.
  85.      
  86. @d term_out == output
  87. @d term_in == input
  88. @z
  89.      
  90. Section 4.
  91. @x
  92. @^debugging@>
  93. @^statistics@>
  94. Some of the code below is intended to be used only when diagnosing the
  95. strange behavior that sometimes occurs when \BibTeX\ is being
  96. installed or when system wizards are fooling around with \BibTeX\
  97. without quite knowing what they are doing. Such code will not normally
  98. be compiled; it is delimited by the codewords
  99. `$|debug|\ldots|gubed|$', with apologies to people who wish to
  100. preserve the purity of English. Similarly, there is some conditional
  101. code delimited by `$|stat|\ldots|tats|$' that is intended only for use
  102. when statistics are to be kept about \BibTeX's memory/cpu usage,
  103. and there is conditional code delimited by `$|trace|\ldots|ecart|$'
  104. that is intended to be a trace facility for use mainly when debugging
  105. \.{.bst} files.
  106.      
  107. @d debug == @{    { remove the `|@{|' when debugging }
  108. @d gubed == @t@>@}  { remove the `|@}|' when debugging }
  109. @f debug == begin
  110. @f gubed == end
  111. @#
  112. @d stat == @{    { remove the `|@{|' when keeping statistics }
  113. @d tats == @t@>@}  { remove the `|@}|' when keeping statistics }
  114. @f stat == begin
  115. @f tats == end
  116. @#
  117. @d trace == @{    { remove the `|@{|' when in |trace| mode }
  118. @d ecart == @t@>@}  { remove the `|@}|' when in |trace| mode }
  119. @f trace == begin
  120. @f ecart == end
  121. @y
  122. @^debugging@>
  123. @^statistics@>
  124. Some of the code below is intended to be used only when diagnosing the
  125. strange behavior that sometimes occurs system wizards are fooling around with
  126. \BibTeX\
  127. without quite knowing what they are doing. There is some conditional
  128. code delimited by `$|stat|\ldots|tats|$' that is intended only for use
  129. when statistics are to be kept about \BibTeX's memory/cpu usage
  130. selected by the qualifier \.{/STATS},
  131. and there is conditional code delimited by `$|trace|\ldots|ecart|$'
  132. that is intended to be a trace facility for use mainly when debugging
  133. \.{.bst} files selected by the qualifier \.{/TRACE}. Since the debugging code
  134. simply referred to some in-line compiler switches, it's been removed entirely.
  135.      
  136. @d stat == if stat_flag then begin
  137. @d tats == end;
  138. @f stat == begin
  139. @f tats == end
  140. @#
  141. @d trace == if trace_flag then begin
  142. @d ecart == end;
  143. @f trace == begin
  144. @f ecart == end
  145. @<Globals in the outer block@>=
  146. @!stat_flag, @!trace_flag: boolean;
  147. @z
  148.      
  149. Section 5.
  150. @x
  151. We assume that |case| statements may include a
  152. default case that applies if no matching label is found,
  153. since most \PASCAL\ compilers have plugged this hole in the language by
  154. incorporating some sort of default mechanism. For example, the \ph\
  155. compiler allows `|others|:' as a default label, and other \PASCAL s allow
  156. syntaxes like `\ignorespaces|else|\unskip' or `\\{otherwise}' or
  157. `\\{otherwise}:', etc. The definitions of |othercases| and |endcases|
  158. should be changed to agree with local conventions.   Note that no semicolon
  159. appears before |endcases| in this program, so the definition of |endcases|
  160. should include a semicolon if the compiler wants one.  (Of course, if no
  161. default mechanism is available, the |case| statements of \BibTeX\ will have
  162. to be laboriously extended by listing all remaining cases. People who are
  163. stuck with such \PASCAL s have in fact done this, successfully but not
  164. happily!)
  165.      
  166. @d othercases == others:  {default for cases not listed explicitly}
  167. @d endcases == @+end {follows the default case in an extended |case| statement}
  168. @f othercases == else
  169. @f endcases == end
  170. @y
  171. We assume that |case| statements may include a
  172. default case that applies if no matching label is found, in VAX Pascal, this
  173. is done using \\{otherwise}.
  174.      
  175. @d othercases == otherwise  {default for cases not listed explicitly}
  176. @d endcases == @+end {follows the default case in an extended |case| statement}
  177. @f othercases == else
  178. @f endcases == end
  179. @z
  180.      
  181. Section 10.
  182. @x
  183. program BibTEX;      {all files are opened dynamically}
  184. @y
  185. program BibTEX(input,output);  {all files are opened dynamically}
  186. @z
  187.      
  188. Section 11.
  189. @x
  190. @<Compiler directives@>=
  191. @{@&$C-,A+,D-@}   {no range check, catch arithmetic overflow, no debug overhead}
  192. @!debug @{@&$C+,D+@}@+ gubed    {but turn everything on when debugging}
  193. @y
  194. On VAX/VMS, there are no compiler directives that can be introduced in this
  195. way, but we take this opportunity to include a few system-dependent goodies.
  196.      
  197. @d VAX_text==@= text @>
  198. @d VAX_new==@= new @>
  199. @d VAX_none==@= none @>
  200. @d VAX_word==@= word @>
  201. @d VAX_error==@= error @>
  202. @d VAX_length==@= length @>
  203. @d VAX_syi_sid==@= syi$_sid @>
  204. @d VAX_continue==@= continue @>
  205. @d VAX_external==@= external @>
  206. @d VAX_readonly==@= readonly @>
  207. @d VAX_volatile==@= volatile @>
  208. @d VAX_aligned==@= aligned @>
  209. @d VAX_unsigned==@= unsigned @>
  210. @d VAX_carriage_control==@= carriage_control @>
  211. @d VAX_io_setmode==@= io$_setmode @>
  212. @d VAX_iom_ctrlcast==@= io$m_ctrlcast @>
  213. @d VAX_immed==@= %immed @>
  214. @d VAX_stdescr==@= %stdescr @>
  215. @d VAX_ref==@= %ref @>
  216. @d VAX_qiow==@= $qiow @>
  217. @d VAX_assign==@= $assign @>
  218. @d VAX_numtim==@= $numtim @>
  219. @d VAX_getsyi==@= $getsyi @>
  220. @d VAX_lib_get_foreign==@= lib$get_foreign @>
  221. @d VAX_disposition==@= disposition @>
  222. @d VAX_delete==@= delete @>
  223. @d VAX_save==@= save @>
  224. @d VAX_varying==@= varying @>
  225. @d VAX_substr==@= substr @>
  226. @d VAX_trnlog==@= $trnlog @>
  227. @d VAX_ss_normal==@= ss$_normal @>
  228. @d VAX_CLI_absent==@= CLI$_ABSENT @>
  229. @d VAX_CLI_comma==@= CLI$_COMMA @>
  230. @d VAX_CLI_concat==@= CLI$_CONCAT @>
  231. @d VAX_CLI_defaulted==@= CLI$_DEFAULTED @>
  232. @d VAX_CLI_locneg==@= CLI$_LOCNEG @>
  233. @d VAX_CLI_locpres==@= CLI$_LOCPRES @>
  234. @d VAX_CLI_negated==@= CLI$_NEGATED @>
  235. @d VAX_CLI_present==@= CLI$_PRESENT @>
  236. @d CLI_get_value==@= CLI$GET_VALUE @>
  237. @d CLI_present==@= CLI$PRESENT @>
  238.      
  239. @<Compiler directives@>=
  240. @= [inherit('SYS$Library:Starlet')] @>
  241. @z
  242.      
  243. Section 13.
  244. @x
  245. procedure initialize;
  246. var @<Local variables for initialization@>
  247. begin
  248. @<Check the ``constant'' values for consistency@>;
  249. if (bad > 0) then
  250.     begin
  251.     write_ln (term_out,bad:0,' is a bad bad');
  252.     goto exit_program;
  253.     end;
  254. @<Set initial values of key variables@>;
  255. pre_def_certain_strings;@/
  256. get_the_top_level_aux_file_name;
  257. end;
  258. @y
  259. procedure initialize;
  260. var @<Local variables for initialization@>
  261. begin
  262. @<Check the ``constant'' values for consistency@>;
  263. if (bad > 0) then
  264.     begin
  265.     write_ln (term_out,bad:0,' is a bad bad');
  266.     goto exit_program;
  267.     end;
  268. @<Read the values of the command line flags@>@;
  269. @<Set initial values of key variables@>;
  270. pre_def_certain_strings;@/
  271. get_the_top_level_aux_file_name;
  272. end;
  273. @z
  274.      
  275. Section 14.
  276. @x
  277. These parameters can be changed at compile time to extend or reduce
  278. \BibTeX's capacity.  They are set to accommodate about 750 cites when
  279. used with the standard styles, although |pool_size| is usually the
  280. first limitation to be a problem, often when there are 500 cites.
  281.      
  282. @<Constants in the outer block@>=
  283. @!buf_size=1000; {maximum number of characters in an input line (or string)}
  284. @!min_print_line=3; {minimum \.{.bbl} line length: must be |>=3|}
  285. @!max_print_line=79; {the maximum: must be |>min_print_line| and |<buf_size|}
  286. @!aux_stack_size=20; {maximum number of simultaneous open \.{.aux} files}
  287. @!max_bib_files=20; {maximum number of \.{.bib} files allowed}
  288. @!pool_size=65000; {maximum number of characters in strings}
  289. @!max_strings=4000; {maximum number of strings, including pre-defined;
  290.               must be |<=hash_size|}
  291. @!max_cites=750; {maximum number of distinct cite keys; must be
  292.               |<=max_strings|}
  293. @!min_crossrefs=2; {minimum number of cross-refs required for automatic
  294.               |cite_list| inclusion}
  295. @!wiz_fn_space=3000; {maximum amount of |wiz_defined|-function space}
  296. @!single_fn_space=100; {maximum amount for a single |wiz_defined|-function}
  297. @!max_ent_ints=3000; {maximum number of |int_entry_var|s
  298.           (entries $\times$ |int_entry_var|s)}
  299. @!max_ent_strs=3000; {maximum number of |str_entry_var|s
  300.           (entries $\times$ |str_entry_var|s)}
  301. @!ent_str_size=100; {maximum size of a |str_entry_var|; must be |<=buf_size|}
  302. @!glob_str_size=1000; {maximum size of a |str_global_var|;
  303.               must be |<=buf_size|}
  304. @!max_fields=17250; {maximum number of fields (entries $\times$ fields,
  305.           about |23*max_cites| for consistency)}
  306. @!lit_stk_size=100; {maximum number of literal functions on the stack}
  307. @y
  308. These parameters can be changed at compile time to extend or reduce
  309. \BibTeX's capacity.  They are set to accommodate about 750 cites when
  310. used with the standard styles, although |pool_size| is usually the
  311. first limitation to be a problem, often when there are 500 cites.
  312.      
  313. Also in this section, we're slipping in some definitions of some CLI constants.
  314.      
  315. @<Constants in the outer block@>=
  316. @!buf_size=1000; {maximum number of characters in an input line (or string)}
  317. @!min_print_line=3; {minimum \.{.bbl} line length: must be |>=3|}
  318. @!max_print_line=79; {the maximum: must be |>min_print_line| and |<buf_size|}
  319. @!aux_stack_size=20; {maximum number of simultaneous open \.{.aux} files}
  320. @!max_bib_files=20; {maximum number of \.{.bib} files allowed}
  321. @!pool_size=65000; {maximum number of characters in strings}
  322. @!max_strings=4000; {maximum number of strings, including pre-defined;
  323.               must be |<=hash_size|}
  324. @!max_cites=750; {maximum number of distinct cite keys; must be
  325.               |<=max_strings|}
  326. @!min_crossrefs=2; {minimum number of cross-refs required for automatic
  327.               |cite_list| inclusion}
  328. @!wiz_fn_space=3000; {maximum amount of |wiz_defined|-function space}
  329. @!single_fn_space=100; {maximum amount for a single |wiz_defined|-function}
  330. @!max_ent_ints=3000; {maximum number of |int_entry_var|s
  331.           (entries $\times$ |int_entry_var|s)}
  332. @!max_ent_strs=3000; {maximum number of |str_entry_var|s
  333.           (entries $\times$ |str_entry_var|s)}
  334. @!ent_str_size=100; {maximum size of a |str_entry_var|; must be |<=buf_size|}
  335. @!glob_str_size=1000; {maximum size of a |str_global_var|;
  336.               must be |<=buf_size|}
  337. @!max_fields=17250; {maximum number of fields (entries $\times$ fields,
  338.           about |23*max_cites| for consistency)}
  339. @!lit_stk_size=100; {maximum number of literal functions on the stack}
  340. @#
  341. @!VAX_CLI_absent=@"000381F0;
  342. @!VAX_CLI_comma=@"0003FD39;
  343. @!VAX_CLI_concat=@"0003FD29;
  344. @!VAX_CLI_defaulted=@"0003FD21;
  345. @!VAX_CLI_locneg=@"00038230;
  346. @!VAX_CLI_locpres=@"0003FD31;
  347. @!VAX_CLI_negated=@"000381F8;
  348. @!VAX_CLI_present=@"0003FD19;
  349. @z
  350.      
  351. Module 22.
  352. @x
  353. @<Types in the outer block@>=
  354. @y
  355. @<Types in the outer block@>=
  356. @!word_type = @=[word]@> -32768..32767;   {16-bit integers}
  357. @z
  358.      
  359. Module 23.
  360. @x last_text_char bug fixed.
  361. @d text_char == char  {the data type of characters in text files}
  362. @d first_text_char=0  {ordinal number of the smallest element of |text_char|}
  363. @d last_text_char=127  {ordinal number of the largest element of |text_char|}
  364. @y
  365. @d text_char == char   {the data type of characters in text files}
  366. @d first_text_char=0   {ordinal number of the smallest element of |text_char|}
  367. @d last_text_char=255  {ordinal number of the largest element of |text_char|}
  368. @z
  369.      
  370. Module 36.
  371. @x
  372. @!alpha_file=packed file of text_char;  {files that contain textual data}
  373. @y
  374. @!alpha_file=text; {files that contain textual data}
  375. @z
  376.      
  377. Module 37.
  378. @x Set up name_of_file using VMS Pascal's string facility
  379. @<Globals in the outer block@>=
  380. @!name_of_file:packed array[1..file_name_size] of char;
  381.        {on some systems this is a \&{record} variable}
  382. @!name_length:0..file_name_size;
  383.   {this many characters are relevant in |name_of_file| (the rest are blank)}
  384. @!name_ptr:0..file_name_size+1;    {index variable into |name_of_file|}
  385. @y
  386. @<Globals in the outer block@>=
  387. @!name_of_file:packed array[1..file_name_size] of char;
  388.        {on some systems this is a \&{record} variable}
  389. @!name_length:unsigned_word;
  390.   {this many characters are relevant in |name_of_file| (the rest are blank)}
  391. @!name_ptr:0..file_name_size+1;    {index variable into |name_of_file|}
  392. @z
  393.      
  394. Module 38.
  395. @x
  396. The \ph\ compiler with which the present version of \TeX\ was prepared has
  397. extended the rules of \PASCAL\ in a very convenient way. To open file~|f|,
  398. we can write
  399. $$\vbox{\halign{#\hfil\qquad&#\hfil\cr
  400. |reset(f,@t\\{name}@>,'/O')|&for input;\cr
  401. |rewrite(f,@t\\{name}@>,'/O')|&for output.\cr}}$$
  402. The `\\{name}' parameter, which is of type `\ignorespaces|packed
  403. array[@t\<\\{any}>@>] of text_char|', stands for the name of
  404. the external file that is being opened for input or output.
  405. Blank spaces that might appear in \\{name} are ignored.
  406.      
  407. The `\.{/O}' parameter tells the operating system not to issue its own
  408. error messages if something goes wrong. If a file of the specified name
  409. cannot be found, or if such a file cannot be opened for some other reason
  410. (e.g., someone may already be trying to write the same file), we will have
  411. |@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|.  This allows
  412. \TeX\ to undertake appropriate corrective action.
  413.      
  414. \TeX's file-opening procedures return |false| if no file identified by
  415. |name_of_file| could be opened.
  416.      
  417. @d reset_OK(#)==erstat(#)=0
  418. @d rewrite_OK(#)==erstat(#)=0
  419.      
  420. @<Procedures and functions for file-system interacting@>=
  421. function erstat(var f:file):integer; extern;  {in the runtime library}
  422. @#@t\2@>
  423. function a_open_in(var f:alpha_file):boolean;  {open a text file for input}
  424. begin reset(f,name_of_file,'/O'); a_open_in:=reset_OK(f);
  425. end;
  426. @#
  427. function a_open_out(var f:alpha_file):boolean;  {open a text file for output}
  428. begin rewrite(f,name_of_file,'/O'); a_open_out:=rewrite_OK(f);
  429. end;
  430. @y
  431. The VAX/VMS \pascal\ compiler with which the present version of
  432. \BibTeX\ was prepared has provided a way to specify a file name on the |open|
  433. command in the manner shown below. For more details, see the VAX/VMS \pascal\
  434. manual.
  435.      
  436. The `\.{/O}' parameter tells the operating system not to issue its own
  437. error messages if something goes wrong. If a file of the specified name
  438. cannot be found, or if such a file cannot be opened for some other reason
  439. (e.g., someone may already be trying to write the same file), we will have
  440. |@!erstat(f)<>0| after an unsuccessful |reset| or |rewrite|.  This allows
  441. \TeX\ to undertake appropriate corrective action.
  442.      
  443. \TeX's file-opening procedures return |false| if no file identified by
  444. |name_of_file| could be opened.
  445.      
  446. @<Procedures and functions for file-system interacting@>=
  447. function a_open_in(var f:alpha_file):boolean;  {open a text file for input}
  448. begin
  449. open(f,name_of_file,VAX_readonly,VAX_error:=VAX_continue);
  450. if status(f)>0 then a_open_in:=false
  451. else begin
  452.  reset(f,VAX_error:=VAX_continue);
  453.  a_open_in:=status(f)<=0;
  454.  end;
  455. end;
  456. @#
  457. function a_open_out(var f:alpha_file):boolean;  {open a text file for output}
  458. begin
  459. open(f,name_of_file,VAX_new,16383,{VAX\_disposition:=VAX\_delete,}
  460.          VAX_error:=VAX_continue);
  461. if status(f)>0 then a_open_out:=false
  462. else begin
  463.  rewrite(f,VAX_error:=VAX_continue);
  464.  a_open_out:=status(f)<=0;
  465.  end;
  466. end;
  467. @z
  468.      
  469.      
  470. Module 75.
  471. @x
  472. pre_define('texinputs:  ',10,file_area_ilk);
  473. s_bst_area := hash_text[pre_def_loc];
  474. pre_define('texbib:     ',7,file_area_ilk);
  475. s_bib_area := hash_text[pre_def_loc];
  476. @y
  477. pre_define('tex_inputs: ',11,file_area_ilk);
  478. s_bst_area := hash_text[pre_def_loc];
  479. pre_define('tex_bib:    ',8,file_area_ilk);
  480. s_bib_area := hash_text[pre_def_loc];
  481. @z
  482.      
  483. Section 100.
  484. @x
  485. @<Procedures and functions for the reading and processing of input files@>=
  486. procedure get_the_top_level_aux_file_name;
  487. label aux_found,@!aux_not_found;
  488. var @<Variables for possible command-line processing@>@/
  489. begin
  490. check_cmnd_line := false;      {many systems will change this}
  491. loop
  492.     begin
  493.     if (check_cmnd_line) then
  494.   @<Process a possible command line@>
  495.       else
  496.   begin
  497.   write (term_out,'Please type input file name (no extension)--');
  498.   if (eoln(term_in)) then      {so the first |read| works}
  499.       read_ln (term_in);
  500.   aux_name_length := 0;
  501.   while (not eoln(term_in)) do
  502.       begin
  503.       if (aux_name_length = file_name_size) then
  504.     begin
  505.     while (not eoln(term_in)) do  {discard the rest of the line}
  506.         get(term_in);
  507.     sam_you_made_the_file_name_too_long;
  508.     end;
  509.       incr(aux_name_length);
  510.       name_of_file[aux_name_length] := term_in^;
  511.       get(term_in);
  512.       end;
  513.   end;
  514.     @<Handle this \.{.aux} name@>;
  515. aux_not_found:
  516.     check_cmnd_line := false;
  517.     end;
  518. aux_found:      {now we're ready to read the \.{.aux} file}
  519. end;
  520. @y
  521. @<Procedures and functions for the reading and processing of input files@>=
  522. procedure get_the_top_level_aux_file_name;
  523. label aux_found,@!aux_not_found;
  524. var @<Variables for possible command-line processing@>@/
  525. begin
  526. check_cmnd_line := true;
  527. loop
  528.     begin
  529.     if (check_cmnd_line) then
  530.   @<Process a possible command line@>
  531.       else
  532.   begin
  533.   write (term_out,'Please type input file name (no extension)--');
  534.   if (eoln(term_in)) then      {so the first |read| works}
  535.       read_ln (term_in);
  536.   aux_name_length := 0;
  537.   while (not eoln(term_in)) do
  538.       begin
  539.       if (aux_name_length = file_name_size) then
  540.     begin
  541.     while (not eoln(term_in)) do begin {discard the rest of the line}
  542.         get(term_in);
  543.         if eof(term_in) then goto exit_program;
  544.         end;
  545.     sam_you_made_the_file_name_too_long;
  546.     end;
  547.       incr(aux_name_length);
  548.       name_of_file[aux_name_length] := term_in^;
  549.       get(term_in);
  550.       if eof(term_in) then goto exit_program;
  551.       end;
  552.   end;
  553.     @<Handle this \.{.aux} name@>;
  554. aux_not_found:
  555.     check_cmnd_line := false;
  556.     end;
  557. aux_found:      {now we're ready to read the \.{.aux} file}
  558. end;
  559. @z
  560.      
  561. Module 101.
  562. @x
  563. @<Variables for possible command-line processing@>=
  564. @!check_cmnd_line : boolean;  {|true| if we're to check the command line}
  565. @y
  566. @<Variables for possible command-line processing@>=
  567. @!check_cmnd_line : boolean;  {|true| if we're to check the command line}
  568. @!i : integer; {scratch integer}
  569. @z
  570.      
  571. Module 102.
  572. @x And finally, here's the code that handles the command line argument.
  573. @<Process a possible command line@>=
  574. begin
  575. do_nothing;    {the ``default system'' doesn't use the command line}
  576. end
  577. @y
  578. On VAX/VMS, we can create a DCL verb to call the executable module. Doing
  579. things in this manner saves us quite a bit of trouble later on since it deals
  580. with much of the command line parsing for us. The CLD file for \BibTeX\ is,
  581. appropriately enough, named \.{BIBTEX.CLD}. This file defines all the command
  582. line parameters and qualifiers. We will only concern ourselves with the
  583. parameter containing the file name in this section.
  584. @<Process a possible command line@>=
  585. begin i:=CLI_get_value('FILESPEC', name_of_file, name_length);
  586. i:=index(name_of_file, '.');
  587. if i<>0 then name_length:=i-1; {If they give us an extension, we don't want it}
  588. aux_name_length:=name_length;
  589. end
  590. @z
  591.      
  592. Module 159.
  593. @x
  594. This version is for printing when in |trace| mode.
  595.      
  596. @<Procedures and functions for all file I/O, error messages, and such@>=
  597.   trace
  598.   procedure trace_pr_fn_class (@!fn_loc : hash_loc);
  599.   begin
  600.   case (fn_type[fn_loc]) of
  601.     built_in : trace_pr ('built-in');
  602.     wiz_defined : trace_pr ('wizard-defined');
  603.     int_literal : trace_pr ('integer-literal');
  604.     str_literal : trace_pr ('string-literal');
  605.     field : trace_pr ('field');
  606.     int_entry_var : trace_pr ('integer-entry-variable');
  607.     str_entry_var : trace_pr ('string-entry-variable');
  608.     int_global_var : trace_pr ('integer-global-variable');
  609.     str_global_var : trace_pr ('string-global-variable');
  610.     othercases unknwn_function_class_confusion
  611.   endcases;
  612.   end;
  613.   ecart
  614. @y
  615. This version is for printing when in |trace| mode.
  616.      
  617. @<Procedures and functions for all file I/O, error messages, and such@>=
  618.   procedure trace_pr_fn_class (@!fn_loc : hash_loc);
  619.   begin
  620.   case (fn_type[fn_loc]) of
  621.     built_in : trace_pr ('built-in');
  622.     wiz_defined : trace_pr ('wizard-defined');
  623.     int_literal : trace_pr ('integer-literal');
  624.     str_literal : trace_pr ('string-literal');
  625.     field : trace_pr ('field');
  626.     int_entry_var : trace_pr ('integer-entry-variable');
  627.     str_entry_var : trace_pr ('string-entry-variable');
  628.     int_global_var : trace_pr ('integer-global-variable');
  629.     str_global_var : trace_pr ('string-global-variable');
  630.     othercases unknwn_function_class_confusion
  631.   endcases;
  632.   end;
  633. @z
  634.      
  635. Module 307.
  636. @x
  637. procedure push_lit_stk (@!push_lt:integer; @!push_type:stk_type);
  638.   trace
  639.   var dum_ptr : lit_stk_loc;  {used just as an index variable}
  640.   ecart@/
  641. @y
  642. procedure push_lit_stk (@!push_lt:integer; @!push_type:stk_type);
  643.   var dum_ptr : lit_stk_loc;  {used just as an index variable}
  644. @z
  645.      
  646. Module 331.
  647. @x
  648. @!b_write : hash_loc;    {\.{write\$}}
  649. @!b_default : hash_loc;    {either \.{skip\$} or \.{default.type}}
  650. @#
  651.   stat
  652.   @!blt_in_loc : array[blt_in_range] of hash_loc; {for execution counts}
  653.   @!execution_count : array[blt_in_range] of integer; {the same}
  654.   @!total_ex_count : integer;    {the sum of all |execution_count|s}
  655.   @!blt_in_ptr : blt_in_range;    {a pointer into |blt_in_loc|}
  656.   tats@/
  657. @y
  658. @!b_write : hash_loc;    {\.{write\$}}
  659. @!b_default : hash_loc;    {either \.{skip\$} or \.{default.type}}
  660. @!blt_in_loc : array[blt_in_range] of hash_loc; {for execution counts}
  661. @!execution_count : array[blt_in_range] of integer; {the same}
  662. @!total_ex_count : integer;    {the sum of all |execution_count|s}
  663. @!blt_in_ptr : blt_in_range;    {a pointer into |blt_in_loc|}
  664. @z
  665.      
  666. Module 459.
  667. @x BibTeX 0.99d?
  668. if (type_list[cite_ptr] = undefined) then
  669.     undefined : trace_pr ('unknown')
  670. @y
  671. if (type_list[cite_ptr] = undefined) then trace_pr ('unknown')
  672. @z
  673.      
  674. Module 467.
  675. @x
  676. This section should be replaced, if necessary, by changes to the program
  677. that are necessary to make \BibTeX\ work at a particular installation.
  678. It is usually best to design your change file so that all changes to
  679. previous sections preserve the section numbering; then everybody's version
  680. will be consistent with the printed program. More extensive changes,
  681. which introduce new sections, can be inserted here; then only the index
  682. itself will get a new section number.
  683. @y
  684. Here are the remaining changes to the program
  685. that are necessary to make \BibTeX\ work on VAX/VMS.
  686.      
  687. @ First, we need to pull in some external functions:
  688. @<Procedures and functions for all file I/O, error messages, and such@>=
  689. @= [ EXTERNAL ] @> function CLI_present(
  690.   entity_desc : @=[CLASS_S]@> packed array [@=$l1@>..@=$u1@>:integer] of char
  691.   ):integer; external;
  692. @#
  693. @= [ EXTERNAL ] @> function CLI_get_value(
  694.   entity_desc : @=[CLASS_S]@> packed array [@=$l1@>..@=$u1@>:integer] of char;
  695.   ret_desc : @=[CLASS_S]@> packed array [@=$l2@>..@=$u2@>:integer] of char;
  696.   var ret_length : @=[UNSAFE]@> unsigned_word := VAX_immed 0
  697.   ):integer; external;
  698.      
  699. @ @<Types in the outer block@>=
  700. unsigned_word = @=[WORD]@> 0..65535;
  701.      
  702. @ Now, we read the command line flag values.
  703. @<Read the values of the command line flags@>=
  704. trace_flag:= ((CLI_present('TRACE') = VAX_CLI_present) or
  705.               (CLI_present('TRACE') = VAX_CLI_defaulted));
  706. stat_flag:=  ((CLI_present('STATS') = VAX_CLI_present) or
  707.               (CLI_present('STATS') = VAX_CLI_defaulted));
  708. @z
  709.      
  710. %%File: BibTeX.CLD
  711. ! CLD file for BibTeX.
  712. !  (HMC Implementation 12/8/88)
  713. !  Don Hosek
  714. define verb BIBTEX
  715. image tex_root:[sources.bibtex0_99]bibtex.exe
  716.   parameter p1,label=filespec,prompt="Input file",value(required,type=$infile)
  717.   qualifier stats,                                        ! default is /NOSTATS
  718.   qualifier trace                                         ! default is /NOTRACE
  719.